package model;

import java.util.HashMap;
import java.util.Map;

import model.actors.ActorTable;
import play.libs.Akka;
import akka.actor.ActorRef;
import akka.actor.ActorSystem;
import akka.actor.Props;

public class Tables {
	//private final ActorSystem tableActorsFactory = ActorSystem.create("Tables");
	private static long counter = 0;
	private static Map<Long, ActorRef> tables = new HashMap<Long, ActorRef>();
	
	public static Object[] createTable(int humanPlayers, int computerPlayers, int entranceFee, int startTokens) {
		ActorRef actor = Akka.system().actorOf(Props.create(model.PokerTP.ActorTable.class, humanPlayers, 
				computerPlayers, entranceFee, startTokens));
		tables.put(counter, actor);
		return new Object[] { counter++, actor };
		
	}
	
	public static ActorRef getTableById(long id) {
		return tables.get(id);
	}
}
